package sudroid.android.net2;

import android.content.Context;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Proxy.Type;
import java.net.SocketAddress;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import sudroid.LogUtils;
import sudroid.TextUtils;
import sudroid.android.NetworkUtil;
import sudroid.android.NetworkUtil.NetworkState;

public final class ProxySelector extends java.net.ProxySelector
{
  private static ProxySelector instance;
  private NetworkUtil mNetworkUtil;
  private ArrayList<java.net.Proxy> proxyList;
  private NetworkUtil.NetworkState state;

  private ProxySelector(Context paramContext)
  {
    ArrayList localArrayList = new ArrayList(1);
    this.proxyList = localArrayList;
    NetworkUtil localNetworkUtil = NetworkUtil.getInstance(paramContext);
    this.mNetworkUtil = localNetworkUtil;
  }

  private void getDefaultProxyList()
  {
    this.proxyList.clear();
    ArrayList localArrayList = this.proxyList;
    java.net.Proxy localProxy = java.net.Proxy.NO_PROXY;
    boolean bool = localArrayList.add(localProxy);
  }

  public static ProxySelector getInstance(Context paramContext)
  {
    if (instance == null)
      instance = new ProxySelector(paramContext);
    return instance;
  }

  private void getMobileProxyList()
  {
    String str = android.net.Proxy.getDefaultHost();
    if (TextUtils.isEmptyOrBlank(str))
    {
      getDefaultProxyList();
      return;
    }
    int i = android.net.Proxy.getDefaultPort();
    if (i != -1);
    while (true)
    {
      this.proxyList.clear();
      ArrayList localArrayList = this.proxyList;
      Proxy.Type localType = Proxy.Type.HTTP;
      InetSocketAddress localInetSocketAddress = new InetSocketAddress(str, i);
      java.net.Proxy localProxy = new java.net.Proxy(localType, localInetSocketAddress);
      boolean bool = localArrayList.add(localProxy);
      break;
      i = 80;
    }
  }

  public void connectFailed(URI paramURI, SocketAddress paramSocketAddress, IOException paramIOException)
  {
    LogUtils.i(">>>>>>>>>> connectFailed() <<<<<<<<<<");
    LogUtils.i("\t\tURI:" + paramURI);
    LogUtils.i("\t\tSocketAddress:" + paramSocketAddress);
    LogUtils.i(paramIOException);
  }

  public List<java.net.Proxy> select(URI paramURI)
  {
    NetworkUtil.NetworkState localNetworkState1 = this.mNetworkUtil.getNetworkState();
    this.state = localNetworkState1;
    int[] arrayOfInt = $SWITCH_TABLE$sudroid$android$NetworkUtil$NetworkState();
    int i = this.state.ordinal();
    switch (arrayOfInt[i])
    {
    default:
      getDefaultProxyList();
    case 2:
    }
    while (true)
    {
      LogUtils.i(">>>>>>>>>> connectFailed() <<<<<<<<<<");
      StringBuilder localStringBuilder1 = new StringBuilder("\t\tNetworkState:");
      NetworkUtil.NetworkState localNetworkState2 = this.state;
      LogUtils.i(localNetworkState2);
      StringBuilder localStringBuilder2 = new StringBuilder("\t\tproxyList:");
      ArrayList localArrayList = this.proxyList;
      LogUtils.i(localArrayList);
      return this.proxyList;
      getMobileProxyList();
    }
  }
}

/* Location:           D:\Program Files\eclipse\apktool-r01-3\新浪微博\classes.dex.dex2jar.jar
 * Qualified Name:     sudroid.android.net2.ProxySelector
 * JD-Core Version:    0.6.0
 */